package com.study.quiz.service.impl;

import com.study.quiz.mapper.UserMapper;
import com.study.quiz.pojo.User;
import com.study.quiz.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

/**
 * @author CJunGod
 * @create 2020-03-07 11:12
 **/
@Slf4j
@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;


    @Override
    public User findByToken(String value) {

        return userMapper.findByToken(value);
    }

    @Override
    public String findByAccountId(String valueOf) {

        return userMapper.findByAccountId(valueOf);
    }

    @Override
    public Integer insert(User user) {

        return userMapper.insert(user);
    }

    @Override
    public List<User> selectIds(Set<Integer> commentators) {

        return userMapper.selectBatchIds(commentators);
    }

    @Override
    public User findByUserId(Integer userId) {

        return userMapper.selectById(userId);
    }
}
